<?php
global $DBobject;
$data = array();
if(!empty($_REQUEST["query"])){
	$sql ="SELECT DISTINCT(CONCAT(postcode_suburb,', ',postcode_state,', ',postcode_postcode)) AS value FROM tbl_postcode WHERE postcode_deleted IS NULL AND CONCAT(postcode_suburb,' ',postcode_state,' ',postcode_postcode) LIKE :query ";
	$params = array('query'=>"%{$_REQUEST["query"]}%");
	$res = $DBobject->wrappedSql($sql,$params);
	foreach($res as $r){
		$data[] = $r['value'];
	}
}

echo json_encode(array("values"=>$data));
die();